package com.xywy.fwc.net;

import java.util.List;

import org.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.xywy.fwc.bean.FwcAssea;
import com.xywy.fwc.bean.FwcMyAddBean;

public class FwcAddParser extends BaseParser<List<FwcMyAddBean>> {

	@Override
	public List<FwcMyAddBean> parseJson(String result) {
		List<FwcMyAddBean> list;
		try {
			JSONObject json = new JSONObject(result);
			int code = json.optInt("code");
			String data = json.optJSONObject("data").optJSONArray("data").toString();
			if(code ==10000){
				Gson gson = new Gson();
				list = gson.fromJson(data , new TypeToken<List<FwcMyAddBean>>(){}.getType());
			}else {
				return null;
			}
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
		return list;
	}

}
